﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using _180FrameWork.CustControls.Models;

namespace _180FrameWork.CustControls
{
    public partial class CustQueryLabel : UserControl
    {
       public CustQueryLabel(string PName,string DisPlay)
        {
            InitializeComponent();
            this.Text = DisPlay;
            this.Name = PName;
            this.Dock = DockStyle.Left;
        }

        public override string Text
        {
            get
            {
                return this.txtFilter.Text;
            }
            set
            {
               this.txtFilter.Text = value;
               this.Width = this.txtFilter.Width + this.btnFilter.Width+2;
               this.txtFilter.AutoSize = false;
               this.txtFilter.Dock = DockStyle.Fill;
            }
        }

        private void btnFilter_Click(object sender, EventArgs e)
        {
            OnClosed(this, e);
        }

        /// <summary>
        /// 点击关闭按钮
        /// </summary>
        [Category("Data")]
        [Description("CustFilterLabel_Closed")]
        public event EventHandler Closed;

        // 执行事件
        protected virtual void OnClosed(object sender,EventArgs e)
        {
            if (Closed != null)
            {
                Closed(this, e);
            }
        }

    }
}
